package com.gm.app.model;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.codehaus.jackson.JsonGenerationException;
import org.codehaus.jackson.map.JsonMappingException;

public class Test {

	protected static Map<StringBuilder, List<String>> getParts(String value,
			String template, boolean isFirst) {
		StringBuilder query = new StringBuilder();
		List<String> params = new ArrayList<String>();
		if (value != null && value.length() > 0) {
			String[] valueParts = value.split(" ");
			for (String part : valueParts) {
				if (isFirst) {
					isFirst = false;
				} else {
					query.append("AND ");
				}
				query.append(template);
				params.add("%" + part + "%");
			}
			if (query.length() == 0) {
				query.append(template);
				params.add(" ");
			}
		}
		Map<StringBuilder, List<String>> map = new HashMap<StringBuilder, List<String>>();
		map.put(query, params);
		return map;
	}

	public static void main(String[] args) throws JsonGenerationException,
			JsonMappingException, IOException {
		BufferedReader br = new BufferedReader(
				new InputStreamReader(
						Test.class
								.getResourceAsStream("/com/gm/app/data/Confirmados2.csv")));
		String strLine;
		while ((strLine = br.readLine()) != null) {
			// Print the content on the console
			System.out.println(strLine);
		}

	}
}
